<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Bdrunpeople/user_edit')}">级别修改</a></li>
		</ul>
		<form class="form-horizontal js-ajax-form" action="{:U('Bdrunpeople/user_edit_post')}" method="post">
			<fieldset>

				<div class="control-group">
					<label class="control-label">{:L('AVATAR')}:</label>
					<div class="controls">
						<img width="25" height="25" src="{$data.avatar}" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('CERT_NUMBER')}:</label>
					<div class="controls">
						{$data.cert_number}
					</div>
				</div>

				<div id="layer-photos-demo" class="layer-photos-demo">
				<div class="control-group">
					<label class="control-label">{:L('CERT_FACE')}:</label>
					<div class="controls">
						<img layer-pid="图片id，可以不写" layer-src="{$data.cert_face}" src="{$data.cert_face}" alt="身份证正面" width="300" height="25" />
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('CERT_WRONG')}:</label>
					<div class="controls">
						<img layer-pid="图片id，可以不写" layer-src="{$data.cert_wrong}" src="{$data.cert_wrong}" alt="身份证反面" width="300" height="25" src="{$data.cert_wrong}" />
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('CERT_HAND')}:</label>
					<div class="controls">
						<img layer-pid="图片id，可以不写" layer-src="{$data.cert_hand}" src="{$data.cert_hand}" alt="手持照片" width="300" height="25" src="{$data.cert_hand}" />
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
						<label class="control-label">{:L('MOBILE')}:</label>
						<div class="controls">
							{$data.mobile}
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">资料提交时间:</label>
						<div class="controls">
							{$data.mater_submit_time}
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">{:L('DISPATCH_NAME')}:</label>
						<div class="controls">
							{$data.dispatch_name}
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">城市:</label>
					<div class="controls">
						{$data['city_id']|getCityName}
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">所属团队:</label>
					<div class="controls">
						{$data['company_id']|getCompanyName}
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:L('CONVEYANCE')}:</label>
					<div class="controls">
						{$data['conveyance_id']|getConveyanceName}
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">跑客原级别:</label>
					<div class="controls">
						{$data['dispatch_level_id']|getDispatchLevel}
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">跑客原经验值:</label>
					<div class="controls">
						{$data.growth_value}
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">跑客团队:</label>
					<div class="controls">
						<select onchange="companyChanged();" id="company"  name="company_id">
							<option value="">==请选择团队==</option>
							<volist name="company_data" id="vo">
								<if condition="$data.company_id == $vo[company_id]">
								<option value="{$vo.company_id}" selected>{$vo.company_name}</option>
									<else />
									<option value="{$vo.company_id}" >{$vo.company_name}</option>
									</if>
							</volist>
						</select></div>
					</div>
					<div class="control-group">
						<label class="control-label">&nbsp;&nbsp;分公司:</label>
						<div class="controls">
						<select name="company_branch" id="company_branch">
							<volist name="branch_data" id="vo">
								<if condition="$data['company_branch'] == $vo['company_branch']" >
									<option value="{$vo.id}" selected>{$vo.b_name}</option>
									<else/>
									<option value="{$vo.id}" >{$vo.b_name}</option>
								</if>
							</volist>
						</select></div>
					</div>
				<div class="control-group">
					<label class="control-label">跑客级别:</label>
					<div class="controls">
						<select class="select_2" name="new_level_id"  id="new_level_id" style="width: 105px;" >
							<volist name="dispatchData" id="vo">
								<if condition="$data.dispatch_level_id == $vo[dispatch_level_id]">
									<option value="{$vo.dispatch_level_id}" selected>{$vo.level_name}</option>
									<else /><option value="{$vo.dispatch_level_id}" >{$vo.level_name}</option>
								</if>
							</volist>
						</select>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<input type="hidden" name="id" value="{$data.dispatch_id}"/>
				<input type="hidden" name="formget[job_number]" value="{$formget.job_number}"/>
				<input type="hidden" name="formget[dispatch_name]" value="{$formget.dispatch_name}"/>
				<input type="hidden" name="formget[is_accept_dispatch]" value="{$formget.is_accept_dispatch}"/>
				<input type="hidden" name="formget[is_audit]" value="{$formget.is_audit}"/>
				<input type="hidden" name="formget[is_sign]" value="{$formget.is_sign}"/>
				<input type="hidden" name="formget[company_id]" value="{$formget.company_id}"/>
				<input type="hidden" name="formget[work_status]" value="{$formget.work_status}"/>
				<input type="hidden" name="formget[mobile]" value="{$formget.mobile}"/>
				<button type="submit" class="btn btn-primary  js-ajax-submit">{:L('SAVE')}</button>
				<a class="btn" href="{:U('Bdrunpeople/user',array('formget'=>$formget))}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		layer.ready(function(){ //为了layer.ext.js加载完毕再执行
			layer.photos({
				photos: '#layer-photos-demo'
				,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
			});
		});
		function companyChanged(company_id){

			if($("#company").val()==3)
				$("#new_level_id").val(12);
			else if($("#company").val()==4 || $("#company").val()==5)
				$("#new_level_id").val(1);
			else if($("#company").val()==2 && {$data.dispatch_level_id} == 12)
				$("#new_level_id").val(3);
			else
				$("#new_level_id").val({$data.dispatch_level_id});

			$.ajax({
				url:"{:U('Bdrunpeople/company_api')}",
				data:"company_id="+$("#company").val(),
				dataType:"JSON",
				success:function(ret){
					console.log(ret);
					if(ret != null && ret.retValue != null ){
						cmbAddOption(ret.retValue);
					}
					else{
						$("#company_branch").focus();
						$("#company_branch").empty();
					}

				}
			});
		}

		function cmbAddOption(ret)
		{
			$("#company_branch").empty();
			var opetion = null;
			for(var i =0; i<ret.length;i++){
				opetion+= '<option value="'+ret[i].id+'">'+ret[i].b_name+'</option>';
			}
			$("#company_branch").append(opetion);
		}

	</script>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
</body>
</html>